package com.demo.text;

import com.demo.entity.Student;

import java.util.*;
import java.util.stream.Collectors;

public abstract class t4 {
    public static void main(String[] args) {
        Student student = new Student("1","zs");
        Student studen1t = new Student("1","zs");
        Set<Student> set = new HashSet<>();
        Collections.addAll(set, studen1t, student);
//        set.stream().forEach(student1 -> System.out.println(student1));
        List<Student> list = new ArrayList<>();
        Collections.addAll(list, student, studen1t);
        list.forEach(student1 -> System.out.println(student1));
        System.out.println("-----------");
//        list.stream().distinct().forEach(student1 -> System.out.println(student1));
        Map<String, Student> collect = list.stream().collect(Collectors.toMap(Student::getId, student1 -> student));

        list.stream().filter((student2)->{
            if (student2.getId().equals("1")) {
               return false;
            }
            return true;
        }).forEach(student1 -> System.out.println(student1.getId()));
//        list.forEach(student1 -> System.out.println(student1));
    }
}
